<!--
 /**
 * Author: hongChengHao
 * Date: 2022-07-26 19:41
 * Desc: 修改密码 modifyPwd
 */
-->
<template>
  <yy-page class="modify-pwd">
    <view class="modify-pwd__content">
      <view class="flex-s-m fs32 pt20 pb20">
        <u-input class="flex-1" v-model="form.oldPwd" :type="isLook ? 'text' : 'password'" placeholder="请输入原始密码" :border="false" clearable>
          <template slot="suffix">
            <u-icon :name="isLook ? 'eye-fill' : 'eye-off'" size="20" @click="isLook = !isLook"></u-icon>
          </template>
        </u-input>
      </view>
      <u-line></u-line>
      <view class="flex-s-m fs32 pt20 pb20">
        <u-input class="flex-1" v-model="form.newPwd" :type="isLook2 ? 'text' : 'password'" placeholder="设置新密码(6-20位数字或字符)" :border="false" clearable>
          <template slot="suffix"> <u-icon :name="isLook2 ? 'eye-fill' : 'eye-off'" size="20" @click="isLook2 = !isLook2"></u-icon> </template
        ></u-input>
      </view>
      <u-line></u-line>
      <view class="flex-s-m fs32 pt20 pb20">
        <u-input class="flex-1" v-model="form.reNewPwd" :type="isLook3 ? 'text' : 'password'" placeholder="确认新密码(6-20位数字或字符)" :border="false" clearable>
          <template slot="suffix"> <u-icon :name="isLook3 ? 'eye-fill' : 'eye-off'" size="20" @click="isLook3 = !isLook3"></u-icon> </template
        ></u-input>
      </view>
    </view>
    <view class="modify-pwd__btn-save" @click="modifyPwd">保存</view>
  </yy-page>
</template>
<script>
  export default {
    name: 'modify-pwd',
    data() {
      return {
        form: {
          idCardNo: '',
          realName: ''
        },
        isLook: false,
        isLook2: false,
        isLook3: false
      }
    },
    onLoad() {
      // this.getRealNameList()
    },
    methods: {
      modifyPwd() {
        uni.$api.user
          .modifyPwd(this.form)
          .then(() => {
            this.$msg.toast('保存成功!')
            setTimeout(() => {
              // this.$reTo('/subPages/userInfo/index')

              this.$tools.navigateTo('/subPages/userInfo/index', {}, 'redirectTo')
            }, 1000)
          })
          .catch((err) => {
            this.$msg.toast(err.data.content)
          })
      }
    }
  }
</script>
<style lang="scss" scoped>
  .modify-pwd {
    &__title {
      padding: 20upx;
      font-weight: bold;
      font-size: 32upx;
    }
    &__content {
      background: #fff;
    }
    &__items {
      display: flex;
      padding: 20upx 50upx;
      border-bottom: 1upx solid #eee;
    }
    &__add {
      text-align: center;
      padding: 20upx 0;
    }
    &__btn-save {
      position: fixed;
      bottom: 50upx;
      left: 50%;
      transform: translateX(-50%);
      width: 90%;
      height: 100upx;
      text-align: center;
      background: $blue;
      color: #fff;
      font-size: 32upx;
      line-height: 100upx;
      border-radius: 100upx;
    }
  }
</style>
